import { createSlice } from '@reduxjs/toolkit'

const storeList = createSlice({
    name: 'storeList',
    initialState: {
        storeList: [],
        tableCheck: [],
        is_group: false,
        look_list: {},//团长审核
        look_list_Administration: {},//团长审核
        administrationCheck: [],//团长审核的选中id
        label_look: '',//团长标签的搜索
        goods_look: '',//商品管理搜索
        is_goods: false,//商品管理搜索
        is_goods_type: false,//商品管理搜索.
        goods_type_look: '',//商品类型管理搜索
        is_goods_brand: false,//商品类型管理搜索
        goods_brand_look: '',//商品品牌管理搜索
        is_goods_label: false,//商品类型管理搜索
        goods_label_look: '',//商品品牌管理搜索
    },
    reducers: {
        setStoreList: (state, action) => {
            state.look_list = action.payload   //团长审核搜索
        },
        setTableCheck: (state, action) => {
            state.tableCheck = action.payload
        },
        setIsGroup: (state) => {
            state.is_group = !state.is_group
        },
        setLookList_Administration: (state, action) => { //团长审核
            state.look_list_Administration = action.payload.list
        },
        setAdministrationCheck: (state, action) => {//团长审核的选中id
            state.administrationCheck = action.payload
        },
        setLabelLook: (state, action) => {//团长标签的搜索
            state.label_look = action.payload
        },
        setGoodsLook: (state, action) => {//商品管理搜索
            state.goods_look = action.payload
        },
        setIsGoods: (state) => {//商品数据刷新
            state.is_goods = !state.is_goods
        },
        setIsGoodsType: (state) => {//商品数据刷新
            state.is_goods_type = !state.is_goods_type
        },
        setGoodsLookType: (state, action) => {//商品管理搜索
            state.goods_type_look = action.payload
        },
        setIsGoodsBrand: (state) => {//商品数据刷新
            state.is_goods_brand = !state.is_goods_brand
        },
        setGoodsLookBrand: (state, action) => {//商品管理搜索
            state.goods_brand_look = action.payload
        },
        setIsGoodsLabel: (state) => {//商品数据刷新
            state.is_goods_label = !state.is_goods_label
        },
        setGoodsLookLabel: (state, action) => {//商品管理搜索
            state.goods_label_look = action.payload
        }
    },
})

export const {
    setStoreList,//团长审核搜索
    setTableCheck,//团长审核的选中id
    setIsGroup,//团长审核的选中id
    setLookList_Administration,//团长审核
    setAdministrationCheck,//团长审核的选中id
    setLabelLook,//团长标签的搜索
    setGoodsLook,//商品管理搜索
    setIsGoods,//商品数据刷新
    setIsGoodsType,//商品数据刷新
    setGoodsLookType,//商品管理搜索
    setIsGoodsBrand,//商品管理搜索
    setGoodsLookBrand,//商品管理搜索
    setIsGoodsLabel,//商品管理搜索
    setGoodsLookLabel,//商品管理搜索
} = storeList.actions
export default storeList.reducer
